<!DOCTYPE >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>参与列表</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/home/css/right.css">
<script type="text/javascript" src="__PUBLIC__/home/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/system.js"></script>
<script type="text/javascript" src="__PUBLIC__/home/js/admin.js"></script>
<style>
    .setting dl{
        display: block;
        width: 750px;
        height: 50px;
        margin: 2px;
    }
    .setting dl dd{
      float:left;  
      margin:6px;
       display: block;
    }
</style>
</head>
<body>
	<div class="basic bor">
		<div class="title fl">当前位置：应用管理 > 应用列表></div>
		<div class="basic_r fr"><a href="{:U('Index/setting')}">基本信息</a></div>
	</div>

<div id = "J_list" > 
    <div class="addnav">
        <a class="submit fr addnews" href="javascript:;" id ="J_addItem"  />添加选项</a>
    </div> 
    <div class="catelist">
        <div class="lists listsov">
        <dd>参与列表</dd> 
        <div class="button">
            <ol>
                <li class="fl" onclick="next()"><</li>
                <li class="fr" onclick="prev()">></li>
            </ol> 
        </div>
        </div> 
    </div>  
    <table border="1"  class="table table-hover text-center" id='list'>
      <tr class="trcolor"> 
        <td>微信昵称</td>
        <td>名字</td>
        <td>手机号码</td>
    	<td>ip</td>
        <td>参与时间</td>
        <td colspan="2">操作</td>
     
      </tr> 
    <!-- ============================================================= -->
    <volist name="apply_list" id="li">
      <tr>  
        <td>{$li.nickname}</td>
        <td>{$li.name}</td>
        <td>{$li.tel}</td>
        <td>{$li.ip}</td>
        <td><?php echo date('Y-m-d H:i:s',$li['ctime']) ?></td>
        <td class="color444 textleft_lover"> 
        <span class="addname"><a href="javascript:;" data-id = "{$li.id}"> 查看</a></span> |
        <span class="addname"><a href="javascript" data-id ="{$li.id}" class="delete"  >删除</a></span></td>
        </td>
      </tr>
    </volist> 
    </table>
    <div class="pages">
       <span class="allxz fl"><input class="checkbox bor" id="all"  type="checkbox" value="3" /></span>  
        <div class="page_s fr">{$page}</div>
    </div>
    </div>

<div class="notice" id= "J_add" style ="display:none;">
<div class="n_title">
    <span class="fl">添加选项</span>
</div>
    <div class="ncontent">
     <form action="" id ="itemForm" method="post" enctype="multipart/form-data" >
        <div class="setting">
            <dl>
                <dd class="setting_t"><span>*</span>选项名称 ：</dd>
                <dd class="setting_p">
                <input class="seinp" type="text" name="name" id ="J_name" value="">
                    <span>名称不能为空</span>
                </dd> 
            </dl>
            <dl>
                <dd class="setting_t fl"><span>*</span> 类型 ：</dd>
                <dd class="setting_p fl">
                   <select  name="type" id="J_type" >
                       <option value="0" >输入框</option>
                        <option value="1" >单选</option>
                        <option value="2" >多选</option>
                        <option value="3" >文本框</option>
                    </volist>
                    </select>
                </dd> 
            </dl>
                 <br>
                <div id = "J_more" style ="display:none;">  
                <dl>
                    <dd class="setting_t fl">答案选项一:</dd>
                    <dd class="setting_p fl">
                    <input class="seinp" type="text" name="item1" id ="J_item1">
                        <span>答案选项不能为空</span>
                    </dd> 
                </dl>
                <dl>
                    <dd class="setting_t fl">答案选项二:</dd>
                    <dd class="setting_p fl">
                    <input class="seinp" type="text" name="item2" id ="J_item2">
                        <span>答案选项不能为空</span>
                    </dd> 
                </dl>
                <dl>
                    <dd class="setting_t fl">答案选项三:</dd>
                    <dd class="setting_p fl">
                    <input class="seinp" type="text" name="item3" id ="J_item3" >
                        <span>答案选项不能为空</span>
                    </dd> 
                </dl>
                <dl>          
                   <dd class="setting_t fl">答案选项四:</dd>
                    <dd class="setting_p fl">
                    <input class="seinp" type="text" name="item4" id ="J_item4">
                        <span>答案选项不能为空</span>
                    </dd> 
                </dl>
                <dl>
                    <dd class="setting_t fl">答案选项五:</dd>
                    <dd class="setting_p fl">
                    <input class="seinp" type="text" name="item5" id ="J_item5">
                        <span>答案选项不能为空</span>
                    </dd>                     
                </div> 
                </dl> 
                <dl>
                    <dd class="setting_t"><span>*</span>排序 ：</dd>
                    <dd class="setting_p">
                    <input class="seinp" type="text" name="sort" value="1" id ="J_sort">
                        <span>排序不能为空</span>
                    </dd> 
                </dl>

                <dl> 
                    <dd class="setting_t fl"> &nbsp;</dd>
                    <dd class="setting_p fl">
                    <input type="hidden" id ="J_id" name ="J_id" value =''>
                    <input  type="hidden" name="app_id" value="{$_GET['id']}">
                    <input class="submit" type="button"  id ="J_submit" value="保存"> 
                    </dd>
                </dl>
             
         </div>
      </form>
    </div>
</div>
</div>
<script>
    $(function(){
        $("#J_more").hide();    
        $("#J_addItem").click(function(){
         $("#J_list").hide();
         $("#J_add").show();
        });
        $("#J_type").change(function(){
            var type = $(this).val(); 
            if(type == 1 || type == 2 ){
                $("#J_more").show();     
            }else{
                $("#J_more").hide();     
            }
        });
        //提交表单
        $("#J_submit").click(function(){
            var url = "{:U('Application/ajaxSubmit')}";
            var data = $('#itemForm').serializeArray(); 
            $.ajax({
                    type: "POST",
                    dataType: 'json',
                    async: false,
                    url: url,
                    data: data,
                    success: function(res){
                        if (res.status == '1') {
                            alert(res.info);
                            window.location.reload();
                        }else{
                            alert(res.info);
                            return false;
                        }
                    },
                    error: function(){
                    },
            });
        });
       //编辑
        $(".edit").click(function(){
        var this_t = $(this);
        var id = this_t.attr('data-id');
        var type = this_t.attr('data-type');
        var name = this_t.attr('data-name');
        var item1 = this_t.attr('data-item1');
        var item2 = this_t.attr('data-item2');
        var item3 = this_t.attr('data-item3');
        var item4 = this_t.attr('data-item4');
        var item5 = this_t.attr('data-item5');
        $("#J_id").val(id);
        $("#J_name").val(name);
        $("#J_type").val(type);
        if(type == 1 || type ==2){
            $("#J_item1").val(item1);
            $("#J_item2").val(item2);
            $("#J_item3").val(item3);
            $("#J_item4").val(item4);
            $("#J_item4").val(item4);
            $("#J_more").show();     
        }else{
            $("#J_more").hide();     
        }
        var sort = this_t.attr('data-sort');
       $("#J_list").hide();
       $("#J_add").show();
        });
    //删除
    $(".delete").click(function(){
        var id = $(this).attr('data-id');
        var url = "{:U('Application/deleteApp')}";
        var data = {"id":id}; 
        $.ajax({
                type: "POST",
                dataType: 'json',
                async: false,
                url: url,
                data: data,
                success: function(res){
                    if (res.status == '1') {
                        alert(res.info);
                        window.location.reload();
                    }else{
                        alert(res.info);
                        return false;
                    }
                },
                error: function(){
                },
        });

    });
    

    });

</script>
<!-- 提示 -->
<p class="ts"><span class="colorf00">*</span><span class="ts_text"> 如果要修排序请直接点击文字修改。</span></p>
</body>
</html>